#ifdef PSOS
  namespace std { }
  
  using namespace std;
  
  #include <string>
  #include <locale>

  #include <Rhapsody.h>
  #include <RapError.h>
#else
  #define Main main
#endif

#include <iostream>
#include <fstream>
#include <memfs.h>

#define LCM_FILENAME            ("/flash/RapIB311XetalLcm")

extern "C" void _main();

void test(void);

extern "C" void Main()
{
#ifdef PSOS
  RapOpen(LCM_FILENAME);
  RapInitialise();

  _main();
#endif

  printf("Dit werkt!\n");

  std::cout << "Dit niet!" << std::endl;

  test();
}

void test(void)
{
  Mfs tfs;
  Mshell tshell(tfs);
  char *element;

  printf("2.2\n");

  std::ifstream tif1;

  printf("2.3\n");

  std::ifstream tif("/flash/trace.xml");

  printf("3\n");

  XMLParser txp(tif);

  printf("4\n");

  tshell.Import(txp, "/");

  printf("5\n");

  tshell.FindInitDirectoryElements("/trace");

  printf("6\n");

  while (!tshell.FindGetNextElement(&element))
  {
    printf("%s\n", element);
  }

  printf("7\n");
}
